package com.appistry.api.rest;

import java.io.InputStream;

import com.appistry.api.rest.domain.RestResponse;
import com.appistry.api.rest.exception.RestException;

public interface RestConnection {
	/**
	 * Performs a GET using the supplied path
	 * 
	 * @param path
	 *            including any query parameters
	 * @return RestResponse
	 * @throws RestException
	 */
	public RestResponse get(String path) throws RestException;

	/**
	 * Performs a POST using the supplied path
	 * 
	 * @param path
	 *            including any query parameters
	 * @param content
	 *            input stream to post
	 * @return RestResponse
	 * @throws RestException
	 */
	public RestResponse post(String path, InputStream content) throws RestException;

	/**
	 * Performs a PUT using the supplied path
	 * 
	 * @param path
	 *            including any query parameters
	 * @param content
	 *            input stream to put
	 * @return RestResponse
	 * @throws RestException
	 */
	public RestResponse put(String path, InputStream content) throws RestException;

	/**
	 * Performs a PUT using the supplied path Used specifically for deployable
	 * files
	 * 
	 * @param path
	 *            including any query parameters
	 * @param length
	 *            length of content
	 * @param content
	 *            input stream to put
	 * 
	 * @return
	 * @throws RestException
	 */
	public RestResponse put(String path, long length, InputStream content) throws RestException;

	/**
	 * Performs a DELETE using supplied path
	 * 
	 * @param path
	 *            including any query parameters
	 * @return RestResponse
	 * @throws RestException
	 */
	public RestResponse delete(String path) throws RestException;

	/**
	 * Performs a MOVE using supplied path
	 * 
	 * @param path
	 *            including any query parameters
	 * @param dest
	 *            destination of where to move file
	 * @return RestResponse
	 * @throws RestException
	 */
	public RestResponse move(String string, String dest) throws RestException;

	/**
	 * Performs a HEAD HTTP operation to retrieve the headers
	 * 
	 * @param path
	 * @return
	 * @throws RestException
	 */
	public RestResponse head(String path) throws RestException;

}
